package com.kaishengit.dao;

import java.util.List;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import com.kaishengit.core.dao.BaseDao;
import com.kaishengit.pojo.ChanceItem;

@Repository
public class ChanceItemDao extends BaseDao<ChanceItem, Integer>{

	@SuppressWarnings("unchecked")
	public List<ChanceItem> findAll(String chancename) {
			String hql = "from ChanceItem where chancename =?";
			Query query = getSession().createQuery(hql);
			query.setParameter(0,chancename);
			return query.list();
		}

	public ChanceItem findByName(String name) {
		String hql = "from ChanceItem where chancename = ?";
		Query query = getSession().createQuery(hql);
		query.setParameter(0, name);
		return  (ChanceItem) query.uniqueResult();
		
	}
	
}
